'''
窗口
'''

import tkinter as tk

class Application(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.pack()
        self.master.geometry('400x300')
        self.master.title('我的第一个窗口')
        self.createWidgets()
        self.__count = 0


    def createWidgets(self):
        self.helloLabel = tk.Label(self, text='Hello, world!')
        self.helloLabel.pack()
        self.quitButton = tk.Button(self, text='Quit', command=self.quit)
        self.quitButton.pack()

        self.quitButton = tk.Button(self, text='点击', command=self.click)
        self.quitButton.pack()
        self.countLabel = tk.Label(self, text='0')
        self.countLabel.pack()
        self.countButton = tk.Button(self, text='+', command=self.add)
        self.countButton.pack()

    def click(self):
        self.helloLabel['text'] = '我被点击了!'

    def add(self):
        self.countLabel['text'] = str(self.inc())

    def inc(self):
        self.__count += 1
        return self.__count


app = Application()
app.mainloop()